package com.igroupes.ovineherd.model.enums;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * 数据库基础字段
 */
public enum SqlFieldKey{
    ID("id",MySqlTypeKey.BIGINT.getCode(),20),
    ADDTIME("add_datetime", MySqlTypeKey.VARCHAR.getCode(), 30),
    ADDUSER("add_user", MySqlTypeKey.VARCHAR.getCode() , 50),
    EDITTIME("edit_datetime", MySqlTypeKey.VARCHAR.getCode(), 30),
    EDITUSER("edit_user", MySqlTypeKey.VARCHAR.getCode() , 50),
    ISDEL("is_del", MySqlTypeKey.BIGINT.getCode() , 20)
    ;

    private String key;
    private String type;
    private Integer length;
    SqlFieldKey(String key, String type, Integer length){
        this.key = key;
        this.type = type;
        this.length = length;
    }

    public String getKey() {
        return key;
    }

    public String getType() {
        return type;
    }

    public Integer getLength() {
        return length;
    }


    public static List<String> baseFieldNameList(){
        return Arrays.stream(SqlFieldKey.values()).map(SqlFieldKey::getKey).collect(Collectors.toList());
    }

}
